<?php
using("Db_Common_ResultSet");

/**
* PDO Resultset.
* 
* This class is a ResultSet wrapper for a native
* PDO Statement Object.
* 
* @author Patrick J. Mizer <patrick.mizer@gmail.com>
* @package junction.db.pdo
* */

class Db_Pdo_ResultSet implements Db_Common_ResultSet
{

   /**
	* Iterator.
	* @var Iterator
	*/ 
	private $_iterator;
	/**
	 * SQL query string.
	 * @var string
	 */
	private $_query;
	
	/**
	 * PDO Query ResultSet Constructor
	 * 
	 * @param Traversable PDO resultset instance
	 * @param string SQL query.
	 */
    public function __construct(Traversable $iterator, $query) 
    {
    	$this->_iterator = $iterator;
    	$this->_query 	= $query;
    }
    
    /**
     * Gets PDO resultset as iterator.
     * 
     * @return Traversable PDO resultset
     */
    public function getIterator()
    {
    	return $this->_iterator;
    }
    
	/**
	 * Gets SQL query.
	 * 
	 * @return string SQL qeury
	 */
	public function getQuery()
	{
		return $this->_query;
	}    
}
?>